
#pragma once

#include <Windows.h>
#include<windowsx.h>
#include <gl/gl.h>
#include <mmsystem.h>
#include <gl/glu.h>
#include "glaux.h"
#include "Matrix4x4f.h"
	

class Window
{
public :
		HWND mHwnd;
		HGLRC mHrc;
		HDC mHdc;
		bool mFullScreen;
		bool mActive;
		RECT *mWindowRect;
		char *mTitle;
		int mBits;
		POINT mMouseCurPosition;
		Window()
		{
			mHwnd = NULL;
			mHrc = NULL;
			mHdc = NULL;
			mFullScreen = false;
			mActive = true;
			mWindowRect = new RECT();
		}
};

class App
{

private:
	
	double mCurrentTime;
	double mLastTime;
public :

	float mDeltaTime;
	Window *mWindow;
	HINSTANCE mHinstance;
	bool *mKeys;
	POINT mMouseCurPosition;
	bool mIsMouseMoving;


	App()
	{
		mWindow = new Window();
		mKeys = new bool[256];
		for(int i=0;i<256;i++)
			mKeys[i] = false;
	}

	~App()
	{
		delete[] mKeys;
		mKeys = NULL;
		delete mWindow;
	}

void Initialize(HINSTANCE hInstance)
{
	mHinstance = hInstance;
	mWindow->mWindowRect->left = 0;
	mWindow->mWindowRect->right = 640;
	mWindow->mWindowRect->top = 0;
	mWindow->mWindowRect->bottom = 480;
	mWindow->mTitle = new char[25];
	mWindow->mTitle = "Color Window";
	mWindow->mBits = 16;
	mWindow->mFullScreen = false;
	
}

void UpdateDeltaTime()
{
	mCurrentTime = timeGetTime();
	mDeltaTime = (float)(mCurrentTime - mLastTime)* 0.001f;
	mLastTime = mCurrentTime;
}

};

namespace Engine
{
	bool CreateGLWindow(HINSTANCE inHinstance,App &inApp);
	LRESULT CALLBACK WndProc(HWND inHwnd,UINT inUmsg,WPARAM inWparam, LPARAM inLparam);
	GLvoid KillGLWindow(App& inApp);
	GLvoid ReSizeGLScene(GLsizei inWidth, GLsizei inHeight);
}